<template>
    <div>
        <div class="top_btn" @click="changeLangEvent">中文</div>
         <div>{{$t('loginPage.login')}}</div>
    </div>
</template>
<script>
export default {
    methods: {
        changeLangEvent() {
              if ( this.$i18n.locale === 'zh-CN' ) {
                    this.$i18n.locale = 'en-US';//关键语句
                    console.log('en-US')
                }else {
                    this.$i18n.locale = 'zh-CN';//关键语句
                    console.log('zh-CN')
                }
                this.$message({
                    type: 'info',
                    message:'已切换'
                });
        }
    } 
}
</script>